#include "enemy.h"

enemy::enemy()
{

}

void enemy::set_values(float x, float y, float w, float h, float spd, float ai, string what_type)
{
        object_type = what_type;
        alive = true;
        box_x = x;
        box_y = y;
        box_w = w;
        box_h = h;
        move_speed = spd;
        speed = spd;
        AI_type = ai;


}

void enemy::giveImage(sf::Texture a)
{
    psprite.setTexture(a);

}

void enemy::movement()
{

    // if (AI_type == 0) // do nothing

    if (AI_type == 1)
    {

        // this needs to be redesigned so that the constant "3" is replaces will a variable
        // this can be done by setting a variable move_speed in the constructure

        // type 1 - the enemy will move right to left
        box_x += move_speed;

        if (box_x+box_w >= SCREEN_W) // if the right side goes out off screen
            move_speed = -speed;
        if (box_x <= 0) // if it goes out of the left bound
            move_speed = speed;


    }



}

void enemy::drawMe()
{
    // draw texture on sprite
    psprite.setPosition(sf::Vector2f(box_x, box_y));

   // scale texture on sprite
    psprite.setScale(sf::Vector2f(1.0f, 1.0f));

}

void enemy::updateMe()
{
    drawMe();
    movement();

}

enemy::~enemy()
{
    //dtor
}
